﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using OurWedding1.Models;

namespace OurWedding1.Controllers
{
    public class HomeController : Controller
    {
        public HomeController() : this(new HomePageParagraphRepository())
        {
        }

        public HomeController(IHomePageParagraphRepository homepageparagraphRepository)
        {
			_homepageparagraphRepository = homepageparagraphRepository;
        }
        private readonly IHomePageParagraphRepository _homepageparagraphRepository;
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
            var model = _homepageparagraphRepository.All.Where(p => p.IsPublished).OrderBy(p => p.Position);

            return View(model);
        }

        public ActionResult About()
        {
            
            Version version = typeof(OurWedding1.Controllers.HomeController).Assembly.GetName().Version;
            DateTime date = new DateTime(2000, 1, 1).AddDays(version.Build).AddSeconds(version.Revision * 2);
            ViewBag.BuildDate = date.ToString();

            ViewBag.Message = date.ToString();
            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}
